<!-- 表格 -->
<table class="layui-hide" id="teacherTable" lay-filter="test33"></table>
<!-- 表格工具 -->
<script>
    var teacherData;
    $(function () {
        layuiDate('.J-date');
        $('#taskid').val(getUrlVariable('taskid'));

        // 删除
        $('.J-remove').click(function () {
            var data = {
                id: $(this).attr('data-id'),
            };
            layerConfirm("{:url('test/teachermove')}", data);
        });
    });

    function initTeacherTable() {
        var table3;
        // 请求路径
        var requireUrl = {
            teacherlist: "{:url('test/gettestteacherlist')}",
        };

        layui.use('table', function () {
           table3 = layui.table;
            table3.render({
                elem: '#teacherTable',
                url: requireUrl.teacherlist,
                toolbar: '#toolbarDemo',
                title: '老师列表',
                totalRow: false,
                // height: 'full-100',
                cols: [
                    [
                        { type: 'checkbox', fixed: 'left' },
                        { field: 'id', title: '序号' },
                        { field: 'teachername', title: '老师姓名' },
                        { field: 'name', title: '考试任务', width: 200 },
                        { field: 'join_num', title: '监考次数', width: 200 },
                        // { field: 'role', title: '老师角色' },
                        { field: 'demo', title: '备注' },
                        { field: 'create_time', title: '创建时间', width: 200 },
                        // , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 100 }
                    ],
                ],
                id: 'teacherTable',
                page: true,
                parseData: function (res) {
                    teacherData = res.record
                    return {
                        code: 0,
                        msg: '',
                        count: res.total,
                        data: res.record,
                    };
                },
            });
        });
    }
</script>
